#pragma once

#include "imcsettingvalue.h"

#include <string>

namespace MCCommon
{

class MCAPI MCSingleValue : public IMCSettingValue
{
public:

    /**
     * Default constructor.
     * 
     */
    MCSingleValue();

    /**
     * Constructor.
     * 
     */
    MCSingleValue
    (
        bool value
    );
    MCSingleValue
    (
        int value
    );
    MCSingleValue
    (
        double value
    );
    MCSingleValue
    (
        const std::string& value
    );

    /**
     * Destructor.
     * 
     */
    virtual ~MCSingleValue();

    /**
     * Create a new object of value.
     * 
     */
    virtual IMCSettingValue* Clone() const;
    
    /**
     * Get value type.
     * 
     */
    virtual ValueType GetValueType() const;

    /**
     * Get bool
     * 
     */
    virtual bool GetBool() const;

    /**
     * Get integer.
     * 
     */
    virtual int GetInt() const;

    /**
     * Get double.
     * 
     */
    virtual double GetDouble() const;

    /**
     * Get string.
     * 
     */
    virtual std::string GetString() const; 

    /**
     * Set values.
     * 
     */
    void SetBool
    (   
        bool value
    );
    void SetInt
    (
        int value
    );
    void SetDouble
    (
        double value
    );
    void SetString
    (
        const std::string& value
    );    

private: 

    DISALLOW_COPY_AND_ASSIGN(MCSingleValue);
        
    /**
     * Union type for numerical value.
     * 
     */
    union NumValue
    {
        bool bval;
        int ival;
        double dval;        
    };

private:

    // Value type.
    ValueType fValueType;

    // The numeric value
    NumValue fNumValue;

    // The string value.
    std::string fStrValue;
};

} // end of namespace MCCommon.